Duplicate Records Genie

Description

Alpha Anywhere adds another powerful productivity tool in the Delete Duplicate Records Genie. The Delete Duplicate Records Genie helps you find, review, and optionally mark or delete duplicate records. Alpha Anywhere has always had a facility to mark and delete duplicate records. Typically, users would use the Mark Duplicate Records operation to mark all duplicate records. Then they would manually preview the marked records to decide which marked records were indeed duplicates. Finally, they would delete the marked duplicates. This new genie makes it much easier to go through these steps because it allows you to easily compare the original record (the master record) with each of the duplicates of that record. as you compare the master record with its duplicates you can decide if you want to retain any record marked for deletion.

The Delete Duplicate Records Genie allows you to:

  • select any combination of fields to examine.

  • select fields by value or by expression

  • examine partial or full field values

  • view the entire record or just the fields with differences

  • interactively compare potential duplicates with the first, or master, instance

  • scroll through duplicates

  • count duplicates

Finding Duplicate Records

  1. From a loaded table select Table > Utilities > Delete Duplicate Records or right click on a table and select Utilities > Delete Duplicate Records to display the following dialog box.

    images/View_Duplicate_Records_Specify_Fields.png
  2. Make a selection from the Method list. The options are:

    • "Specify a List of Fields to Compare"

    • "Specify an Expression (Advanced Method)"

  3. Advanced Options

    If you selected "Specify a List of Fields to Compare" in step 2:

    • 1. Select a field in the Field 1 list.

    • 2. Optionally, click Options ... button to refine the field based search.

      images/View_Duplicate_Records_Advanced_Option.png
    • 3. Optionally, restrict the comparison to the first N characters of the field.

    • 4. Optionally, restrict the comparison to the first N words of the field.

    • 5. Click OK to continue or Cancel to discard your inputs.

    • 6. Optionally, repeat steps 3a to 3e for additional fields.

  4. If you selected "Specify an Expression (Advanced Method)" in step 2:

    • 1. Enter an expression in the Expression field.

    • 2. Optionally, click the 'x-y' icon to display the Expression Builder to help you define the expression.

    • 3. Click OK to continue or Cancel to discard your inputs.

  5. Click Search for Duplicates button to display the following dialog:

    images/View_Duplicate_Records_Number_Found.png
  6. Optionally, select Do not delete any records and click OK. This leaves the duplicates marked and available for future deletion.

  7. Optionally, select Delete all of the marked records now and click OK to remove the duplicates.

  8. Optionally, select Preview the marked records and click OK to display the View Duplicate Records Genie.

    • View Duplicate Records Genie

      This sample screen shot of the View Duplicate Records Genie shows:

      • There are 9 records that have duplicates.

      • The current "master record" has 4 duplicate records. Alpha Anywhere is showing the data in the "master record" and the 1st of the 4 duplicate records for "AZ".

      images/View_Duplicate_Records.png
  9. Initially, the master record is not marked (checked) for deletion. The duplicate records are marked for deletion. Optionally, toggle the check boxes if you decide that you want to keep all records or delete the master record and keep the duplicate records.

  10. Optionally, check Show fields with differences. Alpha Anywhere automatically calculates the fields that have different values, places checkmarks to the left of their names, and displays their values in the main window.

  11. Optionally, if Show fields with differences is not checked, place checkmarks to the left of the fields you want to compare.

  12. Optionally, use the navigation buttons under the master record and the duplicate record to scan the duplicate records and see their field values.

  13. Optionally, click Delete Marked Records to remove duplicate records

  14. Optionally, click Count Records Marked for Deletion to display a message with a count of records marked for deletion.

  15. Click Close to finish.

Using the Mark Duplicate Records Operation

There is another way to get to the Delete Duplicate Records Genie.

  1. Display the Operations tab of the Control Panel.

  2. Click New.

  3. Check the More check box.

  4. Select the Mark Duplicate Records operation, select the table or set you want to process, and click Create.

  5. Click Duplicate Selected Records.

  6. Enter an expression in the Expression field. Optionally, click the 'x-y' icon to display the Expression Builder to help you define the expression.

  7. Click Run on the toolbar.

  8. Click View records in the 'View Duplicates Genie'.

Using Xbasic to Remove Duplicates

Finally, you can also display the Delete Duplicate Records Genie using an Xbasic method:

a5_viewduprecs(tablename as C, duplicate_key_expression as C, run_query_to_find_dups as L )

For example:

dim tbl as T
tbl = table.open("customer")
tbl.mark_range("state",".t.") 'mark all duplicate states
tbl.close()
'open the genie - no need to run the query to mark duplicate states because it has already been run.
A5_viewduprecs("customer", "state", .f.)

Alternatively, open the genie and run a query to mark duplicate states before displaying any data in the genie:

A5_viewduprecs("customer","state",.t.)

See Also